import {fileURLToPath} from 'url'
import nunjucks from 'nunjucks'
export const registryTemplate=function(){
    return async(ctx,next)=>{
        ctx.render=function(html,obj){
            let viewsUrl=new URL('../Views',import.meta.url)
            let viewsPath=fileURLToPath(viewsUrl);
            let env=nunjucks.configure(viewsPath,{noCache:true,watch:true})
            ctx.body=env.render(html,obj)
        }
        await next()
    }
}